#include "Player.h"


Player::Player(void)
{
	setMaxHealth(20);
	setHealth(0);
	
}


Player::~Player(void)
{
}


void Player::setHealth(int health)
{
	this->health = health;

	if(this->health > maxHealth)
		this->health = maxHealth;

	if(this->health < 0)
		this->health = 0;

	notify();
}
int Player::getHealth()
{
	return health;
}

void Player::setExp(double experiance)
{
	this->experiance = experiance;
	notify();
}
double Player::getExp()
{
	return experiance;
}

void Player::setMaxHealth(int health)
{
	this->maxHealth = health;
	notify();
}

int Player::getMaxHealth()
{
	return maxHealth;
}


void Player::addGold(int gold)
{
	this->gold += gold;
	notify();
}

void Player::setGold(int gold)
{
	this->gold = gold;
	notify();
}

void Player::reduceHelth(int reduce)
{
	setHealth(health - reduce);
}

void Player::increaseHealth(int increase)
{
	setHealth(health + increase);
}

void Player::healMax()
{
	setHealth(getMaxHealth());
}

void Player::addExp(double amount)
{
	experiance += amount;
	setExp(experiance);
}

int Player::getGold()
{
	return gold;
}

void Player::reduceGold(int amount)
{
	gold -= amount;
	setGold(gold);
}

void Player::setLevel(int level)
{
	this->level = level;
	notify();
}
int Player::getLevel()
{
	return level;
}

void Player::levelUp()
{
	setLevel(level + 1);
}